
import java.util.Arrays;
import java.util.Scanner;

public class Test {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        System.out.println("请输入1000以内后一个数：");
        int n=sc.nextInt();
        int sum=0;
        for(int i=1;i<n;i++){
            if(n%i==0){
                sum+=i;
            }
        }
        if(sum==n){
            System.out.println(n+"是一个完数");
        }else{
            System.out.println(n+"不是一个完数");

        }
    }
    public static void main5(String[] args) {
        Scanner sc=new Scanner(System.in);
        System.out.print("Please input the length of the array:");
        int len=sc.nextInt();
        int[] array=new int[len];
        for(int i=0;i<len;i++){
            int j=i+1;
            System.out.print("array["+j+"]=");
            array[i]=sc.nextInt();
        }
        Arrays.sort(array);
        System.out.println("最大值"+array[len-1]);
        System.out.println("次大值"+array[len-2]);

    }
    public static int fibonacci(int n){
        if(n==0||n==1){
            return 1;
        }
        else {
            return fibonacci(n-1)+fibonacci(n-2);
        }
    }

    public static void main4(String[] args) {
        for (int i = 0; i < 40; i++) {
            System.out.print(fibonacci(i) + " ");
        }
    }
    public static void main3(String[] args) {
        for (int i = 100; i <=200; i++) {
            boolean isPrime = true;
            for (int k = 2; k <= Math.sqrt(i); k++) {
                if (i % k == 0){
                    isPrime=false;
                    break;
                }
            }
            if(isPrime==true){
                System.out.print(i+" ");
            }
        }
    }

        public static void main2(String[] args) {
            for(int i=0;i<=65/2;i++){
                for (int j = 0; j <= 65/3; j++) {
                    for (int k = 0; k <= 65/4; k++) {
                        if((i+j+k==65)&&2*i==3*j&&2*i==4*k){
                            System.out.println("她家来的客人数为"+2*i);
                            return ;
                        }
                    }
                }
            }
        }


    public static double calculateSquareRoot(double a){
        double x=a/2;
        double tolerance=1.0e-5;
        double difference=1.0;
        while(difference>tolerance){
            double nextX=0.5*(x+a/x);
            difference=Math.abs(nextX-x);
            x=nextX;
        }
        return x;
    }
    public static void main1(String[] args) {
        Scanner sc=new Scanner(System.in);
        System.out.print("请输入a之值：");
        double a=sc.nextDouble();
        double ret=calculateSquareRoot(a);
        System.out.println(a+"的平方根为"+ret);
    }
}
